package com.example.jufei;

import android.content.Context;

import androidx.annotation.NonNull;

//import com.youyi.yesdk.YOUEAdSdk;
//import com.youyi.yesdk.business.YOUEAdConfig;
//import com.youyi.yesdk.business.YOUEAdManager;

import com.bytedance.sdk.openadsdk.TTAdConfig;
import com.bytedance.sdk.openadsdk.TTAdSdk;

import io.flutter.embedding.engine.plugins.FlutterPlugin;
import io.flutter.plugin.common.MethodCall;
import io.flutter.plugin.common.MethodChannel;
import io.flutter.plugin.common.MethodChannel.MethodCallHandler;
import io.flutter.plugin.common.MethodChannel.Result;

/** JufeiPlugin */
public class JufeiPlugin implements FlutterPlugin, MethodCallHandler {
  private MethodChannel channel;
  private Context mcontext;

  @Override
  public void onAttachedToEngine(@NonNull FlutterPluginBinding flutterPluginBinding) {
    channel = new MethodChannel(flutterPluginBinding.getBinaryMessenger(), "jufei");
    channel.setMethodCallHandler(this);
    mcontext = flutterPluginBinding.getApplicationContext();
  }

  @Override
  public void onMethodCall(@NonNull MethodCall call, @NonNull Result result) {
    if (call.method.equals("init")) {
//      TTAdSdk.init(mcontext,new TTAdConfig.Builder()
//              .appId("5197212")
//              .useTextureView(true)
//              .appName("闪金喵")
//              .debug(true)
//              .asyncInit(true)
//              .supportMultiProcess(false)
//      .build());
//      YOUEAdSdk.INSTANCE.initSDK(
//              mcontext,new YOUEAdManager()
//              .appName("闪金喵")
//              .appId("000182")
//              .deBug(true)
//              .supportMultiProcess(false)
//              .build()
//      );
      result.success("Android " + android.os.Build.VERSION.RELEASE);
    }
    else if (call.method.equals("getRewardVideoAd")) {
      result.success(true);
    }
    else if (call.method.equals("getFullVideoAd")) {
      result.success(true);
    }
    else {
      result.notImplemented();
    }
  }

  @Override
  public void onDetachedFromEngine(@NonNull FlutterPluginBinding binding) {
    channel.setMethodCallHandler(null);
  }
}
